﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace DawnOfConquest
{
    class Knight : DawnOfConquest.Unit
    {
        public Knight(string faction, ContentManager content)
        {
            spriteb = content.Load<Texture2D>("UnitSprites/KnightBlue");
            spriter = content.Load<Texture2D>("UnitSprites/KnightRed");
            this.faction = faction;
            name = "Knight";
            strength = 5;
            dex = 3;
            stamina = 6;
            intel = 2;
            will = 3;
            range = 1;
            actionPoints = 7;
            health = stamina * 5;
            level = 1;
            xp = 0;
        }

        public override int getDefense()
        {
            return dex / 2 + strength / 2;
        }

        public override int getAttack()
        {
            return dex / 2 + strength;
        }

        public override int getDamage()
        {
            if (hasMoved)
            {
                return strength * 3;
            }
            else
            {
                return strength + strength / 2;
            }
        }

        public override int maxXP()
        {
            return 100 * level;
        }

        public override void levelUp()
        {
            level++;
            stamina++;
            //health += 10;
            if (level % 2 == 0)
                strength++;
            if (level % 3 == 0)
                dex++;
            if (level % 5 == 0)
                actionPoints++;
            if (stamina * 5 - health >= 10)
            {
                health += 10;
            }
            else
            {
                health = stamina * 5;
            }
            //100 experience to level 2, increase by an additional 100 experience for each successive level
        }
    }
}
